<%@ page import="wmh.day0109.dao.UserDao" %>
<%@ page import="wmh.day0109.dao.impl.UserDaoImpl" %>
<%@ page import="java.util.HashMap" %>
<%@ page import="wmh.day0109.entity.User" %>
<%@ page import="java.util.Map" %>
<%@ page import="java.util.List" %>
<%--
  Created by IntelliJ IDEA.
  User: 12100
  Date: 2023/1/9
  Time: 16:13
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>燃油汽车指标摇号系统</title>
    <link rel="stylesheet" href="../../../css/wmh/day0109/user_travel_manage.css" type="text/css">
<%--    <script type="text/javascript" src="../../../js/wmh/day0109/user_add.js"></script>--%>
    <script type="text/javascript" src="../../../js/wmh/day0109/jquery-3.6.3.js"></script>
    <%
        //jsp组成部分：jsp小脚本  内置对象 （9个内置对象）jsp指定 注释
        //*在jsp页面中获取后端Java程序，进行数据交互
        //1.使用多态体现 ，创建实例化   User
        UserDao userDao = new UserDaoImpl();
        //2.创建Map集合对象，用来存储查询列表的搜索条件参数
        Map<String,Object> map = new HashMap<>();
        //2.1 获取indexController.jsp中存储在request作用域中的searchName
        String searchName = request.getAttribute("searchName") == null ? "" : String.valueOf(request.getAttribute("searchName"));
        if (!"".equals(searchName)) {
            map.put("markNo", searchName);
        }
        //3.调用查询数据列表方法
        List<User> userList = userDao.queryAllUser(map);
    %>
</head>
<body>
<!--网页排版布局：
    上
    中 ：左 中 右
    下-->
<div id="container">
    <header>
        <h1>燃油汽车指标摇号系统</h1>
    </header>
    <div id="main_body">
        <!-- <aside></aside> -->
        <div id="aside">

            <a href="user_add.html">参与摇号用户</a>
            <a href="user_yaohao.html">摇号</a>
        </div>
        <div id="main_center">
            <!-- 	<form> -->
            <div id="search">

                <a href="user_add.html">
                    <button name="btnSearch">添加</button>
                </a>
                <input type="text" class="select_input" name="select_input" placeholder="中签编码">
                <button name="btnSearch">搜索</button>

            </div>
            <table>
                <thead>
                <tr>
                    <th>编号</th>
                    <th>姓名</th>
                    <th>中签编码</th>
                    <th>持照状态</th>
                    <th>手机号码</th>
                    <th>开户日期</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody class="tbody">
                <%
                    for (int i = 0; i < userList.size(); i++) {
                %>
                <tr>
                    <td><%=userList.get(i).getId()%>
                    </td>
                    <td><%=userList.get(i).getUsername()%>
                    </td>
                    <td><%=userList.get(i).getMarkNo()%>
                    </td>
                    <td><%=userList.get(i).getStatus()%>
                    </td>
                    <td><%=userList.get(i).getPhone()%>
                    </td>
                    <td><%=userList.get(i).getDate()%>
                    </td>
                    <td><%=userList.get(i).getUsername()%>
                    </td>
                </tr>
                <% } %>
                </tbody>
            </table>
        </div>

</body>
</html>
